<?php

/***********************************************/
/*CONTENIDO*/
/***********************************************/
echo" <div class=\"pag_content\">
 	<div class=\"pag_content_title\">
		<div class=\"pag_title_cap\">Cap&iacute;tulo 13: </div>
		<div class=\"pag_title_cont\">Gesti&oacute;n del almacenamiento</div>
    </div>
    <div class=\"pag_content_body\">         
	<div class=\"contenido_principal\">	
		<br />";
		
/***********************************************/
/*TITULO PARTE*/
/***********************************************/

echo"	<div class=\"parrafo_titulo\">
	Ejemplo completo
	</div>";		

	
/***********************************************/
/*CONTENIDO*/
/***********************************************/

echo"
<blockquote style=\"COLOR: #2e5348; FONT-SIZE: 12px; FONT-WEIGHT: bold FONT:Arial, Helvetica, sans-serif\">
<pre><p>declare
task_name varchar2(100);
task_descr varchar2(100);
object_id number;
begin
task_name := ''; -- unique name generated
task_descr := 'Free space in OE.CUSTOMERS';

dbms_advisor.create_task(
'Segment Advisor',
 :task_id,
 task_name,
task_descr, NULL);
dbms_advisor.create_object(
task_name,
 'TABLE', 
'OE',
 'CUSTOMERS',
NULL, NULL, object_id);
dbms_advisor.set_task_parameter(task_name, 'RECOMMEND_ALL', 'TRUE');
dbms_advisor.execute_task(task_name);
end;

SQL&GT; print task_id

</p></pre></blockquote>

<div class=\"parrafo\" align=\"justify\">
y para ver las recomendaciones utilizaremos la vista DBA_ADVISOR_FINDINGS.
</div>
<blockquote style=\"COLOR: #2e5348; FONT-SIZE: 12px; FONT-WEIGHT: bold FONT:Arial, Helvetica, sans-serif\">
<pre><p>SQL&GT; select 
owner, task_id, task_name, type, message, more_info 
from 
dba_advisor_findings
 where
 task_id = 680;

OWNER TASK_ID TASK_NAME TYPE
---------- ---------- ------------ -----------
SYS 680 TASK_680 INFORMATION
MESSAGE
----------------------------------------------------------
Enable row movement of the table OE.CUSTOMERS and perform
shrink, estimated savings is 775878 bytes.
MORE_INFO
----------------------------------------------------------
Allocated Space:983040: Used Space:205110:
Reclaimable Space :775878:

</p></pre></blockquote>
<div class=\"parrafo\" align=\"justify\">
Como vemos Segment Advisor nos dice que vamos a recuperar un 80% de espacio. Para implementar su sugerencia podemos mirar en la vista DBA_ADVISOR_ACTIONS.
</div>
<blockquote style=\"COLOR: #2e5348; FONT-SIZE: 12px; FONT-WEIGHT: bold FONT:Arial, Helvetica, sans-serif\">
<pre><p>SQL&GT; ALTER TABLE OE.CUSTOMERS ENABLE ROW MOVEMENT;

SQL&GT; select 
task_id, task_name, command, attr1 
from
 dba_advisor_actions 
where 
task_id = 680;

TASK_ID TASK_NAME COMMAND
---------- ------------ ---------------
680 TASK_680 SHRINK SPACE

ATTR1
---------------------------------------------------------
alter table \"OE\".\"CUSTOMERS\" shrink space
</p></pre></blockquote>

";
	
echo"
	</div> 		 
    </div>
    <div class=\"pag_content_footer\">
    </div>
    <div class=\"pag_content_nav\">		
		<div class=\"pag_contenido_left\">
			<a class=\"cap_next\" href=\"ocp_main.php?cap=13&part=2\">	&lt; Anterior </a>
		 </div>
		<div class=\"pag_contenido_right\" align=\"right\">	
			<a  class=\"cap_next\" href=\"ocp_main.php?cap=13&part=4\">	Siguiente &gt;</a>
		 </div>
	</div>      
</div>
";


?>